using CustomerContactSystem.Core.Infrastructure.Domain;

namespace CustomerContactSystem.Core.Model {
    public class Rep : Entity {
        public virtual string FirstName { get; set; }
        public virtual string SecondName { get; set; }
        public virtual string Email { get; set; }
        public virtual bool IsActive { get; set; }
        public virtual string FullName { 
            get { return FirstName + " " + SecondName; } 
        }

        protected override void Validate() {
            if (string.IsNullOrEmpty(FirstName)) {
                AddBrokenRule(new BusinessRule("FirstName", "First name is required!"));
            }

            if (string.IsNullOrEmpty(SecondName))
            {
                AddBrokenRule(new BusinessRule("SecondName", "Second name is required!"));
            }

            if (string.IsNullOrEmpty(Email))
            {
                AddBrokenRule(new BusinessRule("Email", "Email is required!"));
            }
        }
    }
}